﻿/*
 *┌────────────────────────────────────────────────┐
 *│　描   述：ContextBaseAuto                                                    
 *│　作   者：Zps                                              
 *│　版   本：1.0                                              
 *│　创建时间：2019/10/9 17:11:09                        
 *└────────────────────────────────────────────────┘
 */


using JT.Domain;
using JT.Domain.Detectability;
using JT.Domain.TimeLine;
using Microsoft.EntityFrameworkCore;

namespace JT.Data
{
    public partial class ContextBase
    {
        public virtual DbSet<GeneralLedger> GeneralLedgers { get; set; }
        public virtual DbSet<Summary> Summaries { get; set; }
        public virtual DbSet<Message> Messages { get; set; }
        public virtual DbSet<Year> Years { get; set; }
        public virtual DbSet<TimeLine> TimeLines { get; set; }
        public virtual DbSet<Ability> Abilities { get; set; }
        public virtual DbSet<DetectionRange> DetectionRanges { get; set; }
        public virtual DbSet<StandardMethod> StandardMethods { get; set; }
        public virtual DbSet<MiddleTable> MiddleTables { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Year>().HasData(
                new Year {YearId = 2013}
            );
            modelBuilder.Entity<TimeLine>().HasData(
                new TimeLine
                {
                    Id = 1,
                    Months = Month.Aug,
                    Content = "精泰检测成立了！",
                    YearId = 2013
                }
            );
            modelBuilder.Entity<DetectionRange>().HasData(
                new DetectionRange { Id = 1, Range = "水和废水" },
                new DetectionRange { Id = 2, Range = "空气和废气" },
                new DetectionRange { Id = 3, Range = "室内空气、公共场所空气、工作场所空气" },
                new DetectionRange { Id = 4, Range = "土壤、底质、固体废物" },
                new DetectionRange { Id = 5, Range = "噪声" },
                new DetectionRange { Id = 6, Range = "化肥" },
                new DetectionRange { Id = 7, Range = "初级农产品" }
                ) ; 

            base.OnModelCreating(modelBuilder);

        }
    }
}